package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * 2024年07月23日 13:43
 */
public class Test02_泛型接口 {

    public static void main(String[] args) {
        Person person = new Person("admin", 20);
        Person person2 = new Person("jack", 19);
        if (person.compareTo(person2) > 0) {
            System.out.println("person比person2大");
        } else if (person.compareTo(person2) < 0) {
            System.out.println("person比person2小");
        } else {
            System.out.println("两个人一样大");
        }

        Emp emp = new Emp("alice", 8000.0);
        Emp emp2 = new Emp("tom", 9000.0);
        if (emp.compareTo(emp2) > 0) {
            System.out.println(emp.getName() + "比" + emp2.getName() + "工资高");
        } else if (emp.compareTo(emp2) < 0) {
            System.out.println(emp.getName() + "比" + emp2.getName() + "工资低");
        } else {
            System.out.println(emp.getName() + "与" + emp2.getName() + "收入一致");
        }

    }

}
